<template>
  <div>
    <van-search
      v-model="keywords"
      show-action
      placeholder=""
      @search="onSearch"
      @cancel="onCancel"
      @input="onInput"
    />
    <History
      v-if="blockShow==1"
      :historyListData="historyListData"
    />
    <SearchTipList
      v-else-if="blockShow==2"
      :searchTipsData="searchTipsData"
    />
    <Products
      v-else
      :GoodsList="GoodsList"
    />
  </div>
</template>

<script>
import History from '../../components/History.vue';
import SearchTipList from '../../components/SearchTipList';
import Products from '../../components/Products';
export default {
  data () {
    return {
      keywords: '',
      blockShow: 3,
      historyListData: ["hshs", "sjdfsjdf"],
      searchTipsData: ["jsdfos"],
      GoodsList: []
    };
  },
  created () {

  },
  methods: {
    onSearch (val) {
      this.blockShow = 3;
      this.GoodsList = [{ gid: 1, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },
      { gid: 2, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },
      { gid: 3, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },
      { gid: 4, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },
      { gid: 5, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },
      { gid: 6, gname: '接入交换机', gmodel: 'jfsdfosofhsofhshfdshfdish', bandname: 'huawei', kucun: 21, danxuan: false },]
    },
    onCancel () {
      this.$router.go(-1);
    },
    onInput (val) {
      console.log(val);
    }
  },
  components: {
    History, SearchTipList, Products
  }
}
</script>

<style>
</style>